Title: Replication File for �Academic freedom and the onset of autocratization�
Journal: Democratization
DOI: 10.1080/13510347.2023.2207213
Link: https://doi.org/10.1080/13510347.2023.2207213
Author: Lars Pelke
Correspondence: Lars Pelke, Friedrich-Alexander-University Erlangen-N�rnberg (lars.pelke@fau.de)
Date: April 23th, 2023

Required Software: R and RStudio (4.2.3 or Above). 
Additional required software packages and libraries are specified in the replication code. All used software packages can be found in the replication archive named softbib.pdf (softbib.docx)

Overview: These files replicate all analyses presented in �Academic freedom and the onset of autocratization�, Democratization. https://doi.org/10.1080/13510347.2023.2207213

To replicate all analyses and figures, download all data files to a folder entitled �~/data�, create a second folder entitled �~/results� in the same directory, and run all code files
in numerical order. Create also a third folder named "~/figures" in the same directory to store all graphical outputs. 

The article titled �Academic freedom and the onset of autocratization� conducts two different studies. Study I tests the mirco-level association between academic freedom and inividual democratic
support. Study II tests the probablity of an onset of autocratization at the macro-level (country-years) as a function of acadmeic freedom. 

%%%%%%%%%%%%%% Replication Code %%%%%%%%%%%%%%

%%%%%% Mirco-level Study (Study I) %%%%%%%

11_wvs_data_preparation
Prepares all the individual-level data for merging with macro-level data and cohort-level data. Can be skipped, use pre-processed "wvsdata_prepared.rds" instead

12_data_preparation_macrodata.R
prepares all macro-level data, including current country-year data and cohort-level data. Can be skipped, use "vdem_data.rds" and "vdem_cohort_10.rds" instead. 

13_data_merge_micro_macro.R
Merged mirco- and macro-level data, which were preprared from files 11 and 12. Can be skipped when using "merged_data_master.rds" instead

14_data_analysis_10_cohorts.R
Replicates all main analyses presented in Study I in the main paper, including Table 1 and Figure 2 and 3. 

15_robustness_tests.R
Replicates all robustness tests presented in Supplementary Appendix B.

%%%%%% Marco-level Study (Study II) %%%%%%%

01_academic_freedom_index_construction.R
Replicates the data wrangling process and the Bayesian factor analysis (BFA) model to construct the four-item academic freedom index. The BFA model takes approximately 24 hours to converge.
A pre-processed data file named "academic_freedom_index_cy.rds" can be used for all other scripts. Then, user can skip running 01_academic_freedom_index_construction.R

02_data_analysis_afi.R
Replicates all main analyses presented in the paper, including Table 2 and Figure 4.

03_robustness.R
Replicates all robustness tests presented in Supplementary Appendix C.


%%%%%%%%%%%%%% Data Files (relative path "~/data") %%%%%%%%%%%%%%

Replication data: 
-bfa: all data files that are necessary for running 1_academic_freedom_index_construction.R
-ERT-3.1: Episodes of Regime Transformation data (based von version V-Dem version 11)
-vdem11: Varieties of Democracy data, version 11
-vdem12: Varieties of Democracy data, version 12
-WVS: World Values Survey Data for the mirco-level test conducted in Study I

%%%%%%%%%%%%%% Output Files (relative path "~/results") %%%%%%%%%%%%%%

Store tables

%%%%%%%%%%%%%% Output Files (relative path "~/figures") %%%%%%%%%%%%%%

Store figures

